package com.wms.enums;

public enum WarehouseStatus {
    /**
     * 正常状态
     */
    NORMAL("正常"),

    /**
     * 禁用状态
     */
    DISABLED("禁用");

    private final String value;

    WarehouseStatus(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    /**
     * 根据数据库值获取对应的枚举
     * @param value 数据库值
     * @return 对应的枚举，如果找不到返回null
     */
    public static WarehouseStatus fromValue(String value) {
        for (WarehouseStatus status : WarehouseStatus.values()) {
            if (status.value.equals(value)) {
                return status;
            }
        }
        return null;
    }

    @Override
    public String toString() {
        return this.value;
    }
}
